package com.cy.pj.common.web;

import com.cy.pj.common.pojo.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * 全局异常处理类
 */
@Slf4j
@RestControllerAdvice
public class GlobleExceptionHandler {
    @ExceptionHandler(RuntimeException.class)
    public JsonResult doHandlerException(RuntimeException e){
        log.error("exception {}",e.getMessage());
        e.printStackTrace();
        return new JsonResult(e);
    }
}
